require.config({baseUrl: '/js/lib',urlArgs: "v0.0.1"});
require(['zepto', 'lib'], function($, lib) {
  var fn = {}, lib = new lib();
  $.extend(fn, {
    pageNo: 1,
    pageSize: 20,
    noMore: false,
    init: function(){
      
      this.initPage();
      this.roll();
    },
    initPage: function(){
      var _t = this;
      lib.onLoading();
      lib.ajx(lib.getReq().ser + 'sellerCenter/expandMember.action', {pageNo: _t.pageNo, pageSize: _t.pageSize}, function(data){
        if(data.infocode === '0'){
          if(data.info.memberList.length < _t.pageSize) _t.noMore = true;
          var h = '';
          $.each(data.info.memberList.reverse(), function(k, v){
            h += `<li>
                <ul class="ui-accout-list ui-tixian">
                  <li></li>
                  <li>
                    ${v.loginName}
                  </li>
                  <li>${v.registerDate}</li>
                </ul>
              </li>`;
          });
          $(".ui-accout-detail").append(h);
        }else if(data.infocode == '2') location.href = './login.html?backUrl=' + lib.getBackUrl();
        else lib.showMessage(data.info);
      }, function(){
        lib.showMessage("网络延时，请稍后再试");
      });
    },
    roll: function(){
      var _t = this;
      $(window).scroll(function(){
        if(!_t.noMore &&　$(window).scrollTop() >= $(document).height() - $(window).height()){
          _t.pageNo ++ ;
          _t.initPage();
        }
      });
    }
  });
  fn.init();
});